import requests

from config import BASE_URL


class LoginAPI:

    def __init__(self):
        self.get_inm_code_url = BASE_URL + "/api/captchaImage"
        self.login_url = BASE_URL + "/api/login"

    # 获取图片验证码
    def get_inm_code(self):
        response = requests.get(self.get_inm_code_url)
        return response

    # 登录
    def login(self, username, password, code, uuid):
        login_data = {"username": username, "password": password, "code": code, "uuid": uuid}
        response = requests.post(self.login_url, json=login_data)
        return response
